function detected_byte_sequence=hw4_director(method,h,h_hat,s,v,noise,rho,nt,nr)

power=1000;	%total power being transmitted
noise=1;	%noise at each receiver

detected_byte_sequence=[];
r_previous=[];
%for j=1:2
for j=1:size(s,2)


v=noise*randn(size(v)) + j*noise*randn(size(v));

if(method==1)
	[s_pre,g]=max_rate_precode(s(:,j),h_hat,noise,power,nr,nt);
	r=sqrt(rho/nt)*h*s_pre + v;
	[s_hat,byte_signal] = max_rate_detect(h_hat,r,rho,nt,nr,g);
elseif(method==2)
	[s_pre,g]=equal_snr_precode(s(:,j),h_hat,noise,power,nr,nt);
	r=sqrt(rho/nt)*h*s_pre + v;
	[s_hat,byte_signal] = equal_snr_detect(h_hat,r,rho,nt,nr,g);
elseif(method==3)
	[s_pre,g]=linear_mmse_precode(s(:,j),h_hat,noise,power,nr,nt);
	r=sqrt(rho/nt)*h*s_pre + v;
	[s_hat,byte_signal] = linear_mmse_detect(h_hat,r,rho,nt,nr,g);
elseif(method==4)
	[s_pre,g]=whitening_precode(s(:,j),h_hat,noise,power,nr,nt);
	r=sqrt(rho/nt)*h*s_pre + v;
	[s_hat,byte_signal] = whitening_detect(h_hat,r,rho,nt,nr,g);
end

detected_byte_sequence=horzcat(detected_byte_sequence,byte_signal);


end
